package com.example.administrator.mynaozhong;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.internal.view.menu.MenuView;
import android.view.View;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.SimpleAdapter;
import android.widget.Toast;

/**
 * Created by Administrator on 2017/1/5.
 */

public class SheZhi1Activity extends AppCompatActivity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_shezhi1);

        final ImageView fanhui;

        final CheckBox checkBox1,checkBox2,checkBox3,checkBox4,checkBox5,checkBox6,checkBox7;

        fanhui = (ImageView)findViewById(R.id.fanhui);
        checkBox1 = (CheckBox)findViewById(R.id.checkBox1);
        checkBox2 = (CheckBox)findViewById(R.id.checkBox2);
        checkBox3 = (CheckBox)findViewById(R.id.checkBox3);
        checkBox4 = (CheckBox)findViewById(R.id.checkBox4);
        checkBox5 = (CheckBox)findViewById(R.id.checkBox5);
        checkBox6 = (CheckBox)findViewById(R.id.checkBox6);
        checkBox7 = (CheckBox)findViewById(R.id.checkBox7);

        if (SheZhiActivity.selectedDateStr.contains("周一")) {
            checkBox1.setChecked(true);
        }

        checkBox1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (checkBox1.isChecked()) {
                    if (!SheZhiActivity.selectedDateStr.contains("周一")) {
                        SheZhiActivity.selectedDateStr = "周一";

                    } else {
                        if (SheZhiActivity.selectedDateStr.contains("周一")) {
                            checkBox1.setChecked(false);

                        }
                    }}}


        });


        checkBox2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (checkBox1.isChecked()) {
                    SheZhiActivity.selectedDateStr += "周二";
                } else {

                }

            }
        });


        checkBox3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (checkBox1.isChecked()) {
                    SheZhiActivity.selectedDateStr += "周三";
                } else {

                }

            }
        });


        checkBox4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (checkBox1.isChecked()) {
                    SheZhiActivity.selectedDateStr += "周四";
                } else {

                }

            }
        });


        checkBox5.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (checkBox1.isChecked()) {
                    SheZhiActivity.selectedDateStr += "周五";
                } else {

                }

            }
        });


        checkBox6.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (checkBox1.isChecked()) {
                    SheZhiActivity.selectedDateStr += "周六";
                } else {

                }

            }
        });
        checkBox7.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (checkBox1.isChecked()) {
                    SheZhiActivity.selectedDateStr += "周天";
                } else {

                }
            }
        });



        fanhui.setOnClickListener(new View.OnClickListener() {


            @Override
            public void onClick(View v) {


            }
        });
    }
}

